package com.xz.example2.builder;

import com.xz.example2.model.Actor;
import sun.font.TrueTypeFont;

/**
 * @author 张志航     
 * @version V1.0.0
 * @projectName design_mode
 * @title     ActorBuilder   
 * @package    com.xz.example.builder  
 * @date   2019/11/27 18:58  
 * @explain
 */
public abstract class ActorBuilder {
    protected Actor actor = new Actor();

    public abstract void buildType();
    public abstract void buildSex();
    public abstract void buildFace();
    public abstract void buildCostume();
    public abstract void buildHairstyle();

    // 钩子方法,是否为光头
    public boolean isBarehead(){
        return true;
    }

    // 逐步构建复杂的对象
    public Actor construct(){
        this.buildType();
        this.buildFace();
        if (!this.isBarehead()){
            this.buildHairstyle();
        }
        this.buildCostume();
        this.buildSex();
        return actor;
    }

}
